<template>
  <div id="cash">
    <mt-header fixed :title="this.$route.name">
      <mt-button icon="back" @click.native="$router.go(-1);" slot="left">返回</mt-button>
    </mt-header>
    <nav-bar>
      <div class="navbar" :class="{'navFixed':ScrollState}" ref="NavBar" slot="navbar">
        <div class="navitem  " :class="{active:this.$route.path==('/cash/index')||this.$route.path==('/cash')}">
          <router-link :to="{path:'/cash/index'}" exact>提现</router-link>
        </div>
        <div class="navitem  " :class="{active:this.$route.path==('/cash/record')}">
          <router-link :to="{path:'/cash/record'}" exact>提现记录</router-link>
        </div>
      </div>
    </nav-bar>
    <keep-alive>
      <router-view></router-view>
    </keep-alive>
  </div>
</template>
<script>
  import {
    Indicator
  } from "mint-ui";
  import NavBar from "../../components/Navbar/Navbar";
  export default {
    name: "cash",
    components: {
      NavBar
    },
    data() {
      return {
        stepN: 1,
        weixin: "",
        selected: "",
        H: 0,
        ScrollState: false
      };
    },
    methods: {
      cashStepOne: function() {
        //提现的第一步查询微信号Id 和昵称是否正确
      },
      cashStepTwo: function() {
        //输入提现的金额
      },
      func: function() {},
      fetchData: function() {
        var urlStr = this.$route.path;
        var urlStrArr = urlStr.split("/");
     //   console.log(urlStrArr);
        return urlStrArr[urlStrArr.length - 1];
      },
      handleScroll: function() {
        var scrollTop = document.documentElement.scrollTop || document.body.scrollTop;
        if (scrollTop == 0) {
          this.ScrollState = false;
          document.getElementById('cash').style.paddingTop = 0 + "px"
        }
        if (scrollTop > 0) {
          document.getElementById('cash').style.paddingTop = this.H + "px";
          this.ScrollState = true;
        }
      }
    },
    mounted() {
      //console.log(1);
      document.body.style.background = "#fffbef";
      window.addEventListener("scroll", this.handleScroll);
      // Indicator.open({
      //   text: "加载中...",
      //   spinnerType: "fading-circle"
      // });
      this.H = this.$refs.NavBar.offsetHeight;
    },
    destroyed() {
       window.removeEventListener("scroll", this.handleScroll);
    }
  };
</script>

<style lang="css"  scoped>
  
</style>
